package org.catspaw.cherubim.persistence.spring.jdbc;

import java.sql.PreparedStatement;
import java.sql.SQLException;
import org.springframework.jdbc.core.BatchPreparedStatementSetter;

public class SuitedParameterBatchPreparedStatementSetter implements
		BatchPreparedStatementSetter {

	private Object[][] params;

	public SuitedParameterBatchPreparedStatementSetter(Object[][] params) {
		this.params = params;
	}

	public void setValues(PreparedStatement ps, int i) throws SQLException {
		for (int j = 0; j < params[i].length; j++) {
			SuitedParameterUtils.setSuitedParameter(ps, j + 1, params[i][j]);
		}
	}

	public int getBatchSize() {
		return params.length;
	}
}
